{extend name="$base" /}
{block name="resources"}
<script type="text/javascript" src="__STATIC__/My97DatePicker/WdatePicker.js"></script>
<style>
.count-table .title{
	font-weight:bold;
	margin-bottom:10px;
}
.count-table span{
	display:inline-block;
	width:16%;
}
</style>
{/block}
{block name="main"}
<table class="table-class count-table" style="display:none;">
	<tbody>
		<tr>
			<td width="1%"></td>
			<td>
				<div class="title">会员信息</div>
				<span>会员账号：{$member_detail['user_info']['user_name']}</span>
				<span>会员等级：{$member_detail['level_name']}</span>
			</td>
		</tr>
		<tr>
			<td width="1%"></td>
			<td>
				<div class="title">账户信息</div>
				<span>当前余额：{$member_detail['balance']}</span>
				<span>当前积分：{$member_detail['point']}</span>
			</td>
		</tr>
	</tbody>
</table>
<table class="mytable">
	<tr>
		<td width="10%">
			<input type="text" id='startDate' placeholder="请选择开始日期" class="input-medium input-common" onclick="WdatePicker()"/>
			&nbsp;-&nbsp;
			<input type="text" id='endDate' placeholder="请选择结束日期" class="input-medium input-common" onclick="WdatePicker()" />
			
			<input type="text" id='search_text' placeholder="请输入相关描述" class="input-common" />
			<select id="from_type" class="select-common">
				<option value="">请选择发生方式</option>
				{volist name="from_type_list" id="val"}
				<option value="{$val.type_id}">{$val.type_name}</option>
				{/volist}
			</select>
			<input type="button" onclick="searchData()" value="搜索" class="btn-common" />
		</td>
	</tr>
</table>
<table class="table-class" >
	<colgroup>
		<col style="width: 3%;">
		<col style="width: 15%;">
		<col style="width: 15%;">
		<col style="width: 15%;">
		<col style="width: 15%;">
		<col style="width: 7%;">
		<col style="width: 15%;">
		<col style="width: 15%;">
	</colgroup>
	<thead>
		<tr align="center">
			<th ><input type="checkbox" ></th>
			<th align="left">会员昵称</th>
			<th align="left">账户类型</th>
			<th align="left">产生方式</th>
			<th align="right">数量</th>
			<th ></th>
			<th align="left">描述</th>
			<th>时间</th>
		</tr>
	</thead>
	<tbody id="my-table"></tbody>
</table>
<input type="hidden" id="member_id" value="{$member_id}"/>
{/block}
{block name="script"}
<script type="text/javascript">
function LoadingInfo(page_index) {
	
	var search_text = $("#search_text").val();
	var start_date = $("#startDate").val();
	var end_date = $("#endDate").val();
	var member_id = $("#member_id").val();
	var account_type = $("#account_type").val();
	var from_type = $("#from_type").val();
	
	$.ajax({
		type : "post",
		url : "{:__URL('ADMIN_MAIN/member/balancedetail')}",
		data : {
			"page_index" : page_index,
			"page_size" : $("#showNumber").val(),
			"search_text":search_text, 
			"member_id":member_id,
			"start_date":start_date,
			"end_date":end_date,
			"account_type" : account_type,
			"from_type" : from_type
		},
		success : function(data) {
			if (data["data"].length > 0) {
				$("#my-table").empty();
				for (var i = 0; i < data["data"].length; i++) {
					var html = '';
					html += '<tr align="center">';
					html += '<td><input name="sub" type="checkbox" value="'+ data["data"][i]["id"] +'" ></td>';
					html += '<td align="left">'+data["data"][i]["nick_name"]+'</td>';
					html += '<td align="left">'+data["data"][i]["account_type_name"]+'</td>';
					html += '<td align="left">'+data["data"][i]["type_name"]+'</td>';
					html += '<td align="right">'+ data["data"][i]["number"] +'</td>';
					html += '<td></td>';	
					html += '<td align="left">'+ data["data"][i]["text"] +'</td>';
					html += '<td align="center">'+ timeStampTurnTime(data["data"][i]["create_time"]) +'</td>';
					html += '</tr>';
					html += '<input type="hidden" id="member_id" value="{$member_id}"/>';
					$("#my-table").append(html);
				}
			} else {
				var html = '<tr align="center"><td colspan="8">暂无符合条件的数据记录</td></tr>';
				$("#my-table").html(html);
			}
			initPageData(data["page_count"],data['data'].length,data['total_count']);
			$("#pageNumber").html(pagenumShow(jumpNumber,$("#page_count").val(),{$pageshow}));
		}
	});
}



function searchData(){
	LoadingInfo(1);
}
</script>
{/block}